export default {
//判断数据是否为空
  isEmpty(data) {
    let result = true;
    switch (Object.prototype.toString.call(data)) {
      case "[object Object]":
        result = JSON.stringify(data) === "{}";
        break;
      case "[object Array]":
        result = data.length === 0;
        break;
    }
    return result;
  },
//判断当前环境是否支持LocalStorage
  isSupportLocalStorage() {
    let res = true;
    try {
      localStorage.setItem("_testLocalStorage", "hello world");
      if (localStorage.getItem("_testLocalStorage") !== "hello world") {
        res = false;
      }
      localStorage.removeItem("_testLocalStorage");
    } catch (e) {
      res = false;
    }
    return res;
  }
}